/**
 * @file album.h
 *
 */
#ifndef ALBUM_H
#define ALBUM_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#ifdef LV_CONF_INCLUDE_SIMPLE
#include "lvgl.h"
#include "lv_watch_conf.h"
#else
#include "lvgl/lvgl.h"
#include "../../../lv_watch_conf.h"
#endif

#if USE_LV_WATCH_ALBUM != 0

/*********************
 *      DEFINES
 *********************/
#define PHOTO_MAX_COUNT 20
#define PHOTO_PATH_LEN 18
#define PHOTO_TAB_CNT  3
#define PHOTO_PATH_FILE  "C:/photo_path"
#define PHOTO_SHARE_TMEP_PATH  "C:/share_temp"
/**********************
 *      TYPEDEFS
 **********************/
typedef struct {
    char file_path[PHOTO_PATH_LEN + 1];
    lv_img_dsc_t *preview_src;
    uint32_t size;
    uint8_t index;
    uint8_t selected;
} album_photo_info_t;

typedef struct {
    lv_watch_obj_ext_t lv_watch_obj;
    /*New data for this type */
    lv_obj_t * orderopt_label;
    lv_obj_t * img_page;
    lv_obj_t * obj_par;
    lv_obj_t * tabview;
    lv_obj_t * del_bg;
    lv_obj_t * share_bg;
    lv_obj_t * img_set;
    uint8_t photo_cnt;
    uint8_t photo_tabview_curr_index;
    uint8_t time_order;          /*1--time order, 0--time reverse order*/
    uint8_t preview_mode;        /*1--select mode, 0--view mode*/
    uint8_t from_camera;
    uint8_t selected_cnt;
    bool pressing;
    TIMER_ID timer;
} lv_album_obj_ext_t;

enum {
    ALBUM_BACK_ORDER_SET = 1,
    ALBUM_BACK_QUIT,
    ALBUM_BACK_SETTING,
    ALBUM_BACK_VIEW_PHOTO,
    ALBUM_BACK_SEL_SHARE,
    ALBUM_BACK_SEL_DEV,
};
typedef uint8_t album_back_free_num;

/**********************
 * GLOBAL PROTOTYPES
 **********************/
void album_create_event_cb(lv_obj_t * btn, lv_event_t e);
lv_res_t album_create_from_camera(void);
lv_obj_t * album_create(lv_obj_t * activity_obj);
lv_album_obj_ext_t * album_get_ext(void);
void album_photo_ll_init(void);
void album_photo_ll_destroy(void);
const lv_ll_t * album_get_photo_ll(void);
void album_photo_share_event_cb(lv_obj_t * img, lv_event_t e);
void album_photo_share_flag_reset(void);
lv_fs_res_t album_photo_path_write(char * str);
uint8_t album_photo_ll_get_nodecnt(void);
void album_photo_path_init(void);
void album_load_photo_path(void);
void album_destory(bool start_cam);
#if USE_LV_BLUETOOTH != 0
void album_select_share_way(lv_obj_t * par);
void album_send_file_finish_action(void);
#endif

/**********************
 *      MACROS
 **********************/



#endif /*USE_LV_WATCH_ALBUM*/

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /*ALBUM_H*/
